package com.kerry.configure;

import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;

import com.kerry.servlet.MyServlet1;

@Configuration
public class ServletConfigure {
	
	/**
	 * 代码注册servlet(不需要@ServletComponentScan注解)
	 * @return
	 */
	   @Bean
	    public ServletRegistrationBean servletRegistrationBean() {
	        return new ServletRegistrationBean(new MyServlet1(), "/servlet/myServlet1");// ServletName默认值为首字母小写，即myServlet1
	    }
	   
	   /**
	    * 多个servlet就注册多个bean
	    * @return
	    */
//	   @Bean
//	    public ServletRegistrationBean servletRegistrationBean1() {
//	        return new ServletRegistrationBean(new MyServlet(), "/servlet/myServlet");// ServletName默认值为首字母小写，即myServlet
//	    }
	
//	   @Bean
//	   ...
}
